package com.hqyj.lx.service.impl;

import com.hqyj.lx.dao.StudentDao;
import com.hqyj.lx.pojo.Student;
import com.hqyj.lx.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    //自动装配 生成StudentDao就是mybatis生成的dao代理对象
    @Autowired
    private StudentDao studentDao;

    @Override
    public List<Student> queryAllStudents() {
        return studentDao.queryAllStudents();
    }

    @Override
    public int insertOneStudent(Student student) {

       /* int sId=1;
        String sName="狗蛋";
        String sPassword="123456";
        student1.setsId(sId);
        student1.setsName(sName);
        student1.setsPassword(sPassword);*/
        return studentDao.insertOneStudent(student);
    }

    @Override
    public int deleteOneStudent(int sId) {
        int i = studentDao.deleteOneStudent(sId);
        return i;
    }


    @Override
    public int updateStudent(Student student) {
        return studentDao.updateStudent(student);
    }

    @Override
    public Student queryStudentById(int sId) {
        return studentDao.queryStudentById(sId);
    }

    //学生登录业务实现
    @Override
    public Student login(String userName, String passWord) {
        return studentDao.login(userName,passWord);
    }

}
